import Components from 'unplugin-vue-components/vite'
import { VueUseComponentsResolver } from 'unplugin-vue-components/resolvers'

export const AutoRegisterComponents = () => {
  return Components({
    // Specify component location
    dirs: ['src/components'],
    // Valid file extensions for components
    extensions: ['vue'],
    // Configuration file generation location
    dts: 'src/components.d.ts',
    directoryAsNamespace: false,
    globalNamespaces: [],
    directives: true,
    // search subdirectories
    deep: true,
    include: [/.vue$/, /.vue?vue/],
    exclude: [/[\/]node_modules[\/]/, /[\/].git[\/]/, /[\/].nuxt[\/]/],
    resolvers: [VueUseComponentsResolver()],
  })
}
